package com.xueqi.utils;

import java.util.List;

//分页工具类
public class PageUtils<T> {
    //5个属性
    private int pageIndex;//页码
    private int pageSize=DateUtils.PAGESIZE;//每页显示条数
    private int totalCount;//总条数
    private int totalPages;//总页数
    private List<T> dataList;//查询的结果数据

    public int getPageIndex() {
        return pageIndex;
    }

    public void setPageIndex(int pageIndex) {
        this.pageIndex = pageIndex;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public int getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(int totalCount) {
        this.totalCount = totalCount;
    }

    public int getTotalPages() {
        return totalCount%pageSize>0?totalCount/pageSize+1:totalCount/pageSize;
    }

    public void setTotalPages(int totalPages) {
        this.totalPages = totalPages;
    }

    public List<T> getDataList() {
        return dataList;
    }

    public void setDataList(List<T> dataList) {
        this.dataList = dataList;
    }
}
